package cn.weibo.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "follows", catalog = "weibo")
public class FollowEntity implements Serializable {

    @Id
    @Column(name = "id")
    private long id;

    @Column(name = "isFavorite")
    private boolean favorite;

    @Column(name = "createdOn")
	private Date createdOn;

    @Column(name = "modifiedOn")
	private Date modifiedOn;

    @ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
    @JoinColumn(name = "userID")
    private UserEntity userByUserId;

    @ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
    @JoinColumn(name = "followedID")
    private UserEntity userByFollowedId;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public boolean isFavorite() {
        return favorite;
    }

    public void setFavorite(boolean favorite) {
        this.favorite = favorite;
    }

    public Date getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }

    public Date getModifiedOn() {
        return modifiedOn;
    }

    public void setModifiedOn(Date modifiedOn) {
        this.modifiedOn = modifiedOn;
    }

    public UserEntity getUserByUserId() {
        return userByUserId;
    }

    public void setUserByUserId(UserEntity userByUserId) {
        this.userByUserId = userByUserId;
    }

    public UserEntity getUserByFollowedId() {
        return userByFollowedId;
    }

    public void setUserByFollowedId(UserEntity userByFollowedId) {
        this.userByFollowedId = userByFollowedId;
    }
}
